<script src="/js/autocomplete.js" type="text/javascript"></script>
<div id="step-holder">
    <div class="step-no">1</div>
    <div class="step-dark-left"><a href="">Chọn <?=$this->ten_loai ?></a></div>
    <div class="step-dark-right">&nbsp;</div>
    <div class="step-no-off">2</div>
    <div class="step-dark-left"><a href="">Cho mượn</a></div>
    <div class="step-dark-right">&nbsp;</div>
    <div class="step-no-off">3</div>
    <div class="step-light-left">In</div>
    <div class="step-light-round">&nbsp;</div>
    <div class="clear"></div>
</div>
<body>
<div id="atAutoComplete" style="position:absolute;display:none;"></div>
<form name="frmChoMuon" action="/admin/muon/save" method="POST">
<input type="hidden" name="isNew" value="<?=$this->isNew ?>" />
<input type="hidden" name="id" value="<?=$this->id ?>" />
<input type="hidden" name="loai" value="<?=$this->loai ?>" />
<input type="hidden" name="quyenso" value="<?=$this->quyenso ?>" />
<input type="hidden" name="isPrint" value="0" />
<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
     <tr>
        <th valign="top">Ngày mượn :</th>
        <td><input type="text" class="inp-form" name="ngaymuon" id="ngaymuon" value="<?php
        if($this->ngaytra != '')
        {
            $date_ngaytra = strtotime("+1 day " , strtotime(common::convertToSystemDate($this->ngaytra) )) ;
            echo trim(date('d/m/Y' , $date_ngaytra));
        }else{
            echo date("d/m/Y");
        }
        ?>" /><?=common::datePicker('ngaymuon');?>
        </td>
        <td></td>
    </tr>
     <tr>
        <th valign="top">Ngày trả :</th>
        <td>
            <input type="text" class="inp-form" name="ngaytra" id="ngaytra" value="" /><?=common::datePicker('ngaytra');?></td>
        <td></td>
    </tr>
    <tr>
        <th valign="top">Người mượn:</th>
        <td>
            <!--<input type="text" class="inp-form" name="tennguoimuon" /> -->
            <?php
                $dmsModel = new Admin_Model_Users();
                $dms = $dmsModel->GetUsersById($this->data->ID_U);
                echo common::AutoComplete(
                        $dmsModel->GetListUsers(),"ID_U","FULLNAME","tendms_id","tendms",true,"width: 200px;","",$dms['ID_U'],$dms['FULLNAME'],false);
            ?>
        </td>
        <td></td>
    </tr>
    <tr>
        <th valign="top">Mã thẻ SV (CMND):</th>
        <td>
            <input type="text" maxlength="9" class="inp-form" name="cmnd" />            
        </td>
        <td></td>
    </tr>
    <tr>
        <th valign="top">Đơn vị (Phòng ban):</th>
        <td><input type="text" class="inp-form" name="donvi" /></td>
        <td></td>
    </tr>
    <tr>
        <th valign="top">Điện thoại :</th>
        <td><input type="text" class="inp-form" name="dienthoai" /></td>
        <td></td>
    </tr>
    <tr>
        <th valign="top">Tên <?=$this->ten_loai ?> :</th>
        <td><input type="text" id="title_chomuon" class="title-selectbook-form" name="ten" value="" /></td>
        <td></td>
    </tr>
     <tr>
        <th valign="top">Mã :</th>
        <td><input type="text" id="ma_chomuon" class="inp-form" name="ma" /></td>
        <td></td>
    </tr>    
    <tr>
		<th>&nbsp;</th>
		<td valign="top">
<!--            <input type="button" name="button_chomuon" onclick="choMuon()" class="form-submit" />-->
			<input name="button_chomuon_in" type="button" onclick="print()" value="" class="form-submit-print" />
		</td>
		<td></td>
	</tr>
</table>
</form>
</body>
<script>
    function print(){
        //var texttrtt = document.getElementById('tendms').value ;
        document.frmChoMuon.button_chomuon_in.disabled = true // the nay la het bam  2 lan
        document.frmChoMuon.isPrint.value = "1";
        document.frmChoMuon.target = "print";
        document.frmChoMuon.submit();
    }
    function choMuon(){
        document.frmChoMuon.button_chomuon.disabled = true // the nay la het bam  2 lan
        var JX2 = new Jx();
        var as = 'dfdfdfdf';
        as.leh
        JX2.success('choMuonSuccess');
        JX2.request(document.frmChoMuon);
    }
    function choMuonSuccess(){
       if(status === 'ok')
       {
        alert('Đã cho mượn thành công');
       }
    }
</script>